import { createStore } from "vuex"
const store = createStore({
  state: {
    count: 0,
  },
  actions: {
    changeCount({ commit }) {
      setTimeout(() => {
        commit("CHANGE_COUNT")
      }, 1000)
    },
  },
  mutations: {
    CHANGE_COUNT(state) {
      state.count++
    },
  },
  getters: {
    evenOrOdd(state) {
      return state.count % 2 === 0 ? "偶数" : "奇数"
    },
  },
})
export default store
